﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace myClient
{
    public partial class frmAttibute : Form
    {
        public frmAttibute()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private delegate void ShowInfoDelegate(string[] info); 

        public void ShowDriveInfo(string[] info)
        {
            //lblInfo1.Text = info.ToString();
        }

        public void ShowDirInfo(string[] info)
        {
            //lblInfo1.Text = info;
        }

        public void ShowFileInfo(string[] info)
        {
            if (InvokeRequired)
            {
                this.Invoke(new ShowInfoDelegate(ShowFileInfo), new object[] { info });
                return;
            }

            lblInfo1.Text = "";

            if (info.Length < 6)
                lblInfo1.Text = "Error!";
            else
            {
                lblInfo1.Text += "File Name:          " 
                    + System.IO.Path.GetFileName(CmdParser.GetPara1(info[0])) + "\n\n";                
                lblInfo1.Text += "Size:               " + info[1] + " Bytes\n\n";
                lblInfo1.Text += "Creation Time:      " + info[2] + "\n";
                lblInfo1.Text += "Last Modified Time: " + info[3] + "\n";
                lblInfo1.Text += "Last Access Time:   " + info[4] + "\n\n";
                lblInfo1.Text += "Attributes:\n" + info[5];
            }
            
        }

        private void frmAttibute_Activated(object sender, EventArgs e)
        {
            lblInfo1.Text = "waiting ...";
        }
    }
}
